package com.atguigu.guli.service.base.config;

import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * ClassName: MyBatisPlusConfig <br/>
 * Description: <br/>
 *
 * @author ZMR<br />
 * date: 2020/12/15 16:48<br/>
 * @since JDK 1.11
 */
@Configuration
@MapperScan("com.atguigu.guli.service.*.mapper")
@EnableTransactionManagement
public class MyBatisPlusConfig {
    //    MyBatis的分页插件
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        return new PaginationInterceptor();
    }
    //MyBatisPlus的乐观锁插件
    @Bean
    public OptimisticLockerInterceptor optimisticLockerInterceptor() {
        return new OptimisticLockerInterceptor();
    }
}
